<?php

namespace App\Http\Requests\Api;

use Illuminate\Foundation\Http\FormRequest;

class LoginDTO extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        return [
            'passport' => 'required|between:1,18',
            'password' => 'required|between:5,15',
        ];
    }

    public function messages()
    {
        return [
            'passport.required' => '账号不能为空',
            'passport.between' => '账号格式不合法',
            'password.required' => '请填写密码',
            'password.between' => '密码长度不符合规则',
        ];
    }
}
